<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>企业网站管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/pintuer.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/admin.css">
    <script src="${pageContext.request.contextPath}/js/jquery.js"></script>
    <script src="${pageContext.request.contextPath}/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
    <div class="padding border-bottom">
        <button type="button" class="button border-yellow" onclick="window.location.href='${pageContext.request.contextPath}/toAddManager'"><span class="icon-plus-square-o"></span> 添加内容</button>
    </div>
    <form action="" method="post">
        <table class="table table-hover text-center">
            <tr>
                <th width="10%">序号</th>
                <th width="20%">用户名</th>
                <th width="15%">密码</th>
                <th width="20%">是否禁用</th>
                <th width="15%">操作</th>
            </tr>
            <c:forEach items="${requestScope.listUser}" var="a" varStatus="status" >
                <tr>
                    <td>${status.count}</td>
                    <td>${a.username }</td>
                    <td>${a.password }</td>
                    <td>${a.state}</td>
                    <td><div class="button-group">
                        <a class="button border-main" href="${pageContext.request.contextPath}/findUserById?uid=${a.uid}"><span class="icon-edit"></span> 修改</a>
                        <a class="button border-red" href="javascript:void(0)" onclick="return deleteManager(${a.uid})"><span class="icon-trash-o"></span> 删除</a>
                    </div></td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="8"><div class="pagelist">
                    <a href="${pageContext.request.contextPath}/findUserPageAll?page=${requestScope.pageIndex}">首页</a>
                    <c:choose>
                        <c:when test="${pageInfo.pageNum>1}">
                            <a href="${pageContext.request.contextPath}/findUserPageAll?page=${requestScope.pageInfo.prePage}">上一页</a>
                        </c:when>
                        <c:otherwise>
                            <a>上一页</a>
                        </c:otherwise>
                    </c:choose>
                    <c:forEach begin="1" var="pageNum" end="${pageInfo.pages}">
                        <a href="${pageContext.request.contextPath}/findUserPageAll?page=${pageNum}">${pageNum}</a>
                    </c:forEach>
                    <c:choose>
                        <c:when test="${pageInfo.pageNum<pageInfo.pages}">
                            <a href="${pageContext.request.contextPath}/findUserPageAll?page=${requestScope.pageInfo.nextPage}">下一页</a>
                        </c:when>
                        <c:otherwise>
                            <a>下一页</a>
                        </c:otherwise>
                    </c:choose>
                    <a href="${pageContext.request.contextPath}/findUserPageAll?page=${requestScope.pageInfo.pages}">尾页</a> </div>
                </td>
            </tr>
        </table>
        <script type="text/javascript">
            function deleteManager(id){
                if(confirm("您确定要删除吗?")){
                    window.location.href='${pageContext.request.contextPath}/deleteUser?uid='+id;
                }

            }
        </script>
    </form>
</div>
</body>
</html>
